package com.carrie.tools;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseCookie;

import java.util.Arrays;

/**
 * @author XuHaiLong
 * @since 2025/4/13 22:12
 */
public class LogUtils {
    private static final Logger logger = LoggerFactory.getLogger(LogUtils.class);
    public static void info(String message) {logger.info(message);}
    public static void info(String message,int level) {
        logger.info(message,level);
    }
    public static void info(String[] message) {
        logger.info(Arrays.stream(message).reduce("", (a, b) -> a + b));
    }

    public static void error(String message,String err) {
        logger.info(message,err);
    }
    public static void error(String message, Throwable throwable) {
        StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
        for (StackTraceElement element : stackTrace) {
            logger.info("StackTrace: {}", element.toString());
        }
        logger.error(message, throwable);
    }
    public static void error(String message) {
        logger.error(message);
    }
    public static void error(String message,String url,String Exception) {
        logger.error(message,url,Exception);
    }
    public static void error(String message,String jwt, Throwable throwable) {logger.error(message,jwt,throwable);}
    public static void info(String s, ResponseCookie responseCookie) {logger.info(s,responseCookie);}
}
